﻿using Net.Web.Framework.Mvc.Routes;
using Net.Web.Framework.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Net.Web.Infrastructure
{
    public partial class RouteProvider : IRouteProvider
    {
        /// <summary>
        /// 自定义路由
        /// </summary>
        /// <param name="routes"></param>
        public void RegisterRoutes(RouteCollection routes)
        {

            //home page
            routes.MapLocalizedRoute("HomePage",
                            "",
                            new { controller = "Home", action = "Index" },
                            new[] { "Net.Web.Controllers" });


            //login
            routes.MapLocalizedRoute("Login",
                            "login/",
                            new { controller = "Customer", action = "Login" },
                            new[] { "Net.Web.Controllers" });
            //register
            routes.MapLocalizedRoute("Register",
                            "register/",
                            new { controller = "Customer", action = "Register" },
                            new[] { "Net.Web.Controllers" });
            //logout
            routes.MapLocalizedRoute("Logout",
                            "logout/",
                            new { controller = "Customer", action = "Logout" },
                            new[] { "Net.Web.Controllers" });


            //customer
            routes.MapLocalizedRoute("CustomerInfo",
                            "customer/info",
                            new { controller = "Customer", action = "Info" },
                            new[] { "Net.Web.Controllers" });

            //sitemap
            routes.MapLocalizedRoute("Sitemap",
                            "sitemap",
                            new { controller = "Common", action = "Sitemap" },
                            new[] { "Net.Web.Controllers" });
            
            //topics
            routes.MapLocalizedRoute("TopicPopup",
                            "t-popup/{SystemName}",
                            new { controller = "Topic", action = "TopicDetailsPopup" },
                            new[] { "Net.Web.Controllers" });
                       
            //robots.txt
            routes.MapRoute("robots.txt",
                            "robots.txt",
                            new { controller = "Common", action = "RobotsTextFile" },
                            new[] { "Net.Web.Controllers" });

            //sitemap (XML)
            routes.MapLocalizedRoute("sitemap.xml",
                            "sitemap.xml",
                            new { controller = "Common", action = "SitemapXml" },
                            new[] { "Net.Web.Controllers" });
                        
            //install
            routes.MapRoute("Installation",
                            "install",
                            new { controller = "Install", action = "Index" },
                            new[] { "Net.Web.Controllers" });

            //company
            routes.MapRoute("Company",
                            "gongsi",
                            new { controller = "Company", action = "List" },
                            new[] { "Net.Web.Controllers" });
            
            //job
            routes.MapRoute("Job",
                            "job",
                            new { controller = "Job", action = "List" },
                            new[] { "Net.Web.Controllers" });
            //job
            routes.MapRoute("CreateJob",
                            "createjob",
                            new { controller = "Job", action = "CreateJob" },
                            new[] { "Net.Web.Controllers" });
            //Resume
            routes.MapRoute("Resume",
                            "resume",
                            new { controller = "Resumes", action = "List" },
                            new[] { "Net.Web.Controllers" });
            
            //GetPassword
            routes.MapRoute("GetPassword",
                            "reset",
                            new { controller = "Customer", action = "GetPassword" },
                            new[] { "Net.Web.Controllers" });
            
            //page not found
            routes.MapLocalizedRoute("PageNotFound",
                            "page-not-found",
                            new { controller = "Common", action = "PageNotFound" },
                            new[] { "Net.Web.Controllers" });

            //Category
            //getCategory
            routes.MapLocalizedRoute("GetCategoryById",
                            "GetCategoryById",
                            new { controller = "Job", action = "GetCategoryById" },
                            new[] { "Net.Web.Controllers" });
        }


        public int Priority
        {
            get
            {
                return 0;
            }
        }
    }
}